<?php
/**
 * If you are not authorized to modify this file, do NOT touch it.
 * @file common.inc.php
 * @author SkyWorld
 * @date 2010-1-16
 * @description The file which should be included by any application based on this framework.
 */


 /**
 * The following codes are for security issues.
 */
define('IN_NCG', true); //Preventing illegal access to framework files.

//Disabling Magic Quotes feature in PHP if magic_quotes_gpc option is set to on in php.ini.
//Magic Quotes is deprecated since PHP 5.3, and it is not recommended to use.
if (get_magic_quotes_gpc())
{
	$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
	while (list($key, $val) = each($process))
	{
		foreach ($val as $k => $v)
		{
			unset($process[$key][$k]);
			if (is_array($v))
			{
				$process[$key][stripslashes($k)] = $v;
				$process[] = &$process[$key][stripslashes($k)];
			}
			else
			{
				$process[$key][stripslashes($k)] = stripslashes($v);
			}
		}
	}
	unset($process);
}


/**
 * The following definitions are for portability issues.
 */

define('NCG_INC', dirname(__file__) . '/');
define('NCG_LIB', NCG_INC . 'lib/');
define('NCG_DLL',NCG_INC.'dll/');
define('NCG_PATH', dirname(__file__) . '/../');
define('NCG_CONFIG', NCG_PATH . 'config/');
define('NCG_INSTALL', NCG_PATH . 'install/');
define('NCG_CACHE', NCG_PATH . 'cache/');
define('NCG_TEMPLATES', NCG_PATH . 'templates/');
define('NCG_TEMPLATES_C', NCG_PATH . 'templates_C/');


/**
 * The following definitions are for code readability.
 */

//Define database type constants.
define('DB_TYPE_MYSQL', 1);
define('DB_TYPE_ORACLE', 2);
define('DB_TYPE_MSSQL', 3);



require_once (NCG_CONFIG.'db.config.php');
require_once (NCG_CONFIG.'global.config.php');
require_once (NCG_LIB . 'template.func.php');
require_once (NCG_LIB . 'security.func.php');
require_once (NCG_LIB . 'cache.func.php');
require_once (NCG_LIB . 'file.func.php');
require_once (NCG_LIB. 'db.class.php');
require_once (NCG_DLL. 'verify.func.php');
require_once (NCG_DLL. 'common.func.php');

/**
 * Date time related initialization.
 */
date_default_timezone_set($globalConfig[timezone]); //Set the default timezone.

/**
 * connect to the database
 */
//global $db;
$db= new db($dbConfig['host'],$dbConfig['user'],$dbConfig['password'],$dbConfig['dbname'],$dbConfig['port']);
$pre =  $dbConfig['tablepre'];
?>
